<?php
include("../conn.php");
include 't-cookie.php';
?>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>答辩评分-教师端</title>
    <link rel="stylesheet" type="text/css" href="../css/htmleaf-demo.css">
    <link rel="stylesheet" type="text/css" href="../css/nav.css">
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">

    <link rel="stylesheet" href="../css/bootstrap-theme.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script type="text/javascript" src="../js/bootstrap3.0.3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="../css/style.css">


    <script type="text/javascript">
        function change() {
            document.getElementById("input-tr1").readOnly = false;
            document.getElementById("input-tr1").style.border = "1px solid #000000";
            document.getElementById("input-tr2").readOnly = false;
            document.getElementById("input-tr2").style.border = "1px solid #000000";
            document.getElementById("input-tr3").readOnly = false;
            document.getElementById("input-tr3").style.border = "1px solid #000000";
            document.getElementById("input-tr4").readOnly = false;
            document.getElementById("input-tr4").style.border = "1px solid #000000";
            document.getElementById("input-tr5").readOnly = false;
            document.getElementById("input-tr5").style.border = "1px solid #000000";
            document.getElementById("input-tr6").readOnly = false;
            document.getElementById("input-tr6").style.border = "1px solid #000000";
            document.getElementById("input-tr7").readOnly = false;
            document.getElementById("input-tr7").style.border = "1px solid #000000";
            document.getElementById("input-tr8").readOnly = false;
            document.getElementById("input-tr8").style.border = "1px solid #000000";


        }
        function save() {
            document.getElementById("input-tr1").readOnly = true;
            document.getElementById("input-tr1").style.border = "0";
            document.getElementById("input-tr2").readOnly = true;
            document.getElementById("input-tr2").style.border = "0";
            document.getElementById("input-tr3").readOnly = true;
            document.getElementById("input-tr3").style.border = "0";
            document.getElementById("input-tr4").readOnly = true;
            document.getElementById("input-tr4").style.border = "0";
            document.getElementById("input-tr5").readOnly = true;
            document.getElementById("input-tr5").style.border = "0";
            document.getElementById("input-tr6").readOnly = true;
            document.getElementById("input-tr6").style.border = "0";
            document.getElementById("input-tr7").readOnly = true;
            document.getElementById("input-tr7").style.border = "0";
            document.getElementById("input-tr8").readOnly = true;
            document.getElementById("input-tr8").style.border = "0";

        }
        //		    function delete(){
        //		    	document.getElementById("input-tr1").readOnly = true;
        //              document.getElementById("input-tr1").style.border="0";
        //		    }
    </script>

</head>

<body class="bodycolor">

<nav class="navbar navbar-default navbar-fixed-top" style="clear: left;">
    <div class="container">
        <div class="navbar-right navfont" id="navbar-collapse">
            <p>华软网络技术系毕业管理系统</p>
        </div>
        <a href="t-cookie.php?cookie=out" id="out">退出</a>
    </div>

</nav>

<div class="nav topx navbackground-t" id="nav">
    <div>

        <div style="border-bottom:1px solid rgba(255,255,255,.1)"><img src="../images/mini.png"></div>
    </div>
    <ul>
        <li class="nav-item">
            <a href="t-index.php"><i class="my-icon nav-icon icon_2"></i><span>首页</span><i class="my-icon nav-more"></i></a>

        </li>
        <li class="nav-item">
            <a href="t-mykt.php"><i class="my-icon nav-icon icon_1"></i><span>我的课题</span><i
                    class="my-icon nav-more"></i></a>
        </li>
        <li class="nav-item">
            <a href="t-checkproject.php"><i class="my-icon nav-icon icon_6"></i><span>选课核查</span><i
                    class="my-icon nav-more"></i></a>
        </li>
        <li class="nav-item">
            <a href="#"><i class="my-icon nav-icon icon_3"></i><span>评分评语</span><i class="my-icon nav-more"></i></a>
            <ul>
                <li>
                    <a href="t-GuideMark.php"><span>指导评分</span></a>
                </li>
                <li>
                    <a href="t-ThesisMark.php"><span>论文评分</span></a>
                </li>
                <li>
                    <a href="t-ReplyMark.php"><span>答辩评分</span></a>
                </li>
            </ul>
        </li>
        <li class="nav-item">
            <a href="t-all.php"><i class="my-icon nav-icon icon_6"></i><span>答辩汇总</span><i
                    class="my-icon nav-more"></i></a>

        </li>
        <li class="nav-item">
            <a href="#"><i class="my-icon nav-icon icon_3"></i><span>资料管理</span><i class="my-icon nav-more"></i></a>
            <ul>
                <li>
                    <a href="t-information.php"><span>我的资料</span></a>
                </li>
                <li>
                    <a href="t-mystudent.php"><span>我的学生</span></a>
                </li>

            </ul>
        </li>
    </ul>
</div>


<div class="indexborder">
    <center>
        <div width="100%">

            <div class="box-inline indexdiv1 panel panel-default auto" align="center">
                <div class="panel panel-default">
                    <div class="panelbt">
                        <h3 class="panel-title">答辩评分</h3>
                    </div>
                    <div class="panel-body">
                        <table class="table table-striped table-condensed "  id="tg">
                            <thead>
                            <tr class="thcolor-t">
                                <th class="th1">课题名称</th>
                                <th class="th2">指导教师</th>
                                <th class="th3">学号</th>
                                <th class="th4">学生</th>
                                <th class="sore">项8</th>
                                <th class="sore">项9</th>
                                <th class="sore">项10</th>
                                <th class="sore">项11</th>
                                <th class="mark1">评语</th>
                                <th class="th2">修改/删除</th>
                            </tr>
                            </thead>
                            <?php
                            $sql = "SELECT p.ProjectName, t.TeacherName,s.StudentId, s.StudentName,r.Order8,r.Order9,r.Order10,r.Order11,r.remark,r.ReplyMarkId
															FROM replymark AS r
															JOIN project AS p ON r.Project_ProjectId = p.ProjectId
															JOIN teacher AS t ON r.Teacher_TeacherId = t.TeacherId
															JOIN student AS s ON p.Student_StudentId = s.StudentId
															WHERE r.Teacher_TeacherId=" . $_SESSION["t-id"] . " and p.Year=" . $_SESSION["t-Year"];
                            $query = mysqli_query($conn, $sql);

                            while ($row = mysqli_fetch_array($query)) {
                                ?>
                                <tr>
                                    <td data-label="课题名称"><?= $row[0] ?></td>
                                    <td data-label="指导教师"><?= $row[1] ?></td>
                                    <td data-label="学号"><?= $row[2] ?></td>
                                    <td data-label="学生"><?= $row[3] ?></td>
                                    <td data-label="项8"><input name="sore8" type="text"
                                                               value="<?= $row[4] ?>"
                                                               readonly="readonly" style="border: 0;"/>
                                    </td>
                                    <td data-label="项9"><input name="sore9" type="text"
                                                               value="<?= $row[5] ?>"
                                                               readonly="readonly" style="border: 0;"/>
                                    </td>
                                    <td data-label="项10"><input name="sore10" type="text"
                                                                value="<?= $row[6] ?>"
                                                                readonly="readonly" style="border: 0;"/>
                                    </td>
                                    <td data-label="项11"><input name="sore11" type="text"
                                                                value="<?= $row[7] ?>"
                                                                readonly="readonly" style="border: 0;"/>
                                    </td>

                                    <td data-label="评语"><textarea name="remark" name="remark"
                                                                  type="text" value="<?= $row[8] ?>"
                                                                  readonly="readonly"
                                                                  style="border: 0;resize:none"><?= $row[8] ?></textarea>
                                    </td>
                                    <td style="display: none"><input name="ProjectId"
                                                                     value="<?= $row[9] ?>"></td>
                                    <td data-label="修改/删除">
                                        <button type="button" class="btn btn-success btn-xs" onclick="change(this)">修改
                                        </button>
                                        <button type="button" name="marktype" value="thesismark"
                                                class="btn btn-success btn-xs" onclick="save(this)">保存
                                        </button>
                                    </td>
                                </tr>
                            <?
                            }
                            ?>
                        </table>
                    </div>
                </div>


            </div>

        </div>
</div>

<!--<footer class="indexfooter container-fluid  bottom">
    <p class="footer-p" align="center">地址：广东省广州市从化区经济开发区高技术产业园广从南路548号 | 电话：020－87818918 邮编：510990 | 网站公安备案编号：4401840100050 粤ICP备：05085382号 站长统计</p>
</footer>-->


<script>
    window.jQuery || document.write('<script src="../js/jquery-1.11.0.min.js"><\/script>')
</script>
<script type="text/javascript" src="../js/nav.js"></script>
<script type="text/javascript">
    function change(t) {
        var a = t;
        var b = a.parentNode.parentNode.getElementsByTagName('input');
        var c = a.parentNode.parentNode.getElementsByTagName('textarea');
        c[0].readOnly = false;
        c[0].style.border = "1px solid #000000";
        for (var i = 0; i < b.length; i++) {
            b[i].readOnly = false;
            b[i].style.border = "1px solid #000000";
        }
    }

    function save(t) {
        var a = t;
        var b = a.parentNode.parentNode.getElementsByTagName("input");
        var c = a.parentNode.parentNode.getElementsByTagName('textarea');
        var remarks = c[0].value;
        var sores = new Array();
        for (var i = 0; i < b.length; i++) {
            sores[i] = b[i].value;
        }
        var msg = "您真的确定要修改吗？\n\n请确认！";
        var data = encodeURI(remarks);
        if (confirm(msg) == true) {
            $.ajax({
                type: "get",
                url: "t-mark.php",
                data: "sore8=" + sores[0] + "&sore9=" + sores[1] + "&sore10=" + sores[2] + "&sore11=" + sores[3] + "&remark=" + data + "&marktype=replymark&ProjectId=" + sores[4],
                success: function (msg) {
                    alert(msg);
                    myWindow = window.open("t-ReplyMark.php", "_self");
                }
            });
        }


        c[0].readOnly = true;
        c[0].style.border = "0";
        for (var i = 0; i < b.length; i++) {
            b[i].readOnly = true;
            b[i].style.border = "0";
        }


    }
</script>
<script>
    $(document).ready(function(){
        $("tr:even input").css("background-color","#f0f8ff");
        $("tr:even textarea").css("background-color","#f0f8ff");
        $("tr:odd input").css("background-color","#f9f9f9");
        $("tr:odd textarea").css("background-color","#f9f9f9");
    });
</script>
</body>

</html>